home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C26 / CGI_GET.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  766 b   |  24 lines

  1. //: C26:CGI_GET.cpp
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. // Tests CGImap by extracting the information
  7. // from a CGI GET submitted by an HTML Web page.
  8. #include "CGImap.h"
  9.  
  10. int main() {
  11.   // You MUST print this out, otherwise the 
  12.   // server will not send the response:
  13.   cout << "Content-type: text/plain\n" << endl;
  14.   // For a CGI "GET," the server puts the data
  15.   // in the environment variable QUERY_STRING:
  16.   CGImap query(getenv("QUERY_STRING"));
  17.   // Test: dump all names and values
  18.   for(CGImap::iterator it = query.begin();
  19.     it != query.end(); it++) {
  20.     cout << (*it).first << " = "
  21.       << (*it).second << endl;
  22.   }
  23. } ///:~
  24.